<template>
	<view class="page">
		<view class="fu-tabbar" :style="[{ height: CustomBar + 'px' }]">
			<view style="width: 35%;" v-if="orderType == 3||orderType == -1">
				<view :style="[{ height: StatusBar + 'px' }]"></view>
				<view class="flex justify-around align-center"
					:style="[{ height: CustomBar - StatusBar + 'px' }]">
					<text class="order-type" :class="[orderType == 3?'actives':'']" @click="orderTypeChange(3)">订单<text
							class="title_i"></text></text>
					<!-- <text class="order-type" :class="[orderType == 5?'active':'']" @click="orderTypeChange(5)">拼团订单</text> -->
					<text class="order-type" :class="[orderType == -1?'actives':'']"
						@click="orderTypeChange(-1)">售后<text class="title_i"></text></text>
				</view>
			</view>
		</view>
		<!-- 	<view class="search-wrap">
			<view class="cu-bar search bg-white">
				<view class="search-form round">
					<text class="cuIcon-search"></text>
					<input v-model="keywords" :adjust-position="false" type="text" placeholder="请输入订单号"
						confirm-type="search" @confirm="handleSearch" />
					<text v-if="keywords.length != 0" class="cuIcon-roundclosefill text-lg text-gray padding-right-xs"
						@tap="handleClear"></text>
				</view>
			</view>
		</view> -->
		<view class="filter-box bg-white flex align-center">
			<view class="flex  padding-bottom-sm padding-top-xs flex-sub" v-if="orderType == 3">
				<block v-for="(item,index) in normalTabs" :key='item.id'>
					<view class="text-df text-center flex-sub" :class="[type == item.id?'active':'']"
						@click="tabChange(item)">{{item.name}}
						<view class="title_a"></view>
					</view>

				</block>
			</view>
			<view class="flex padding-bottom-sm padding-top-xs flex-sub" v-if="orderType == 5">
				<block v-for="(item,index) in assembleTabs" :key='item.id'>
					<view class="text-df margin-left" :class="[type == item.id?'active':'']"
						@click="tabChange(item)">{{item.name}}
						<view></view>
					</view>
				</block>
			</view>
			<view class="flex padding-bottom-sm padding-top-xs flex-sub" v-if="orderType == -1">
				<block v-for="(item,index) in afterTabs" :key='item.id'>
					<view class="text-df text-center flex-sub" :class="[type == item.id?'active':'']"
						@click="tabChange(item)">{{item.name}}
						<view class="title_a"></view>
					</view>
				</block>
			</view>
			<view class="flex  padding-bottom-sm padding-top-xs flex-sub" v-if="orderType == 20 || orderType == 21">
				<block v-for="(item,index) in transportTabs" :key='item.id'>
					<view class="text-df text-center flex-sub" :class="[type == item.id?'active':'']"
						@click="tabChange(item)">{{item.name}}
						<view class="title_a"></view>
					</view>
				</block>
			</view>
			<!-- <view class="flex padding-bottom-sm padding-top-xs margin-right margin-left-xs align-center"
				@click="filterShow">
				<image class="filter-icon margin-right-xs" src="../../static/filter.png" mode=""></image>
				<text>筛选</text>
			</view> -->
		</view>
		<!-- 订单 start -->
		<view class="order-list" v-if="orderType == 20">
			<block v-for="(item, index) in listData" :key="item.order_sn">
				<view class="order-item" @click.stop="handleDetail(item)">
					<view class="order-item-title flex justify-between align-center">
						<view class="text-666 text-df">
							<text>{{ item.create_time }}</text>
						</view>
						<view class="order-item-title-status text-df"
							:style="{color:(item.status == -1 || item.status == -3)?'#999':''}">
							<text>{{item.status | transportTabs}}</text>
						</view>
					</view>
					<!-- 地址信息 start -->
					<view class="address-wrap margin-bottom-sm order-radio-top-half" v-if="item.addressInfo">
						<view class="address flex justify-start">
							<view class="address-img flex justify-center align-center">
								<image src="../../static/10175.png" mode=""></image>
							</view>
							<view class="address-info">
								<view class="address-title flex justify-start align-center text-bold">

									<view class="address-name text-333 text-lg">{{item.addressInfo.receiver_name2}}
									</view>
									<view class="address-phone text-333 text-lg">{{ item.addressInfo.receiver_mobile2 }}
									</view>
								</view>
								<view class="address-pos text-333 text-df">
									{{ item.addressInfo.province2 }}{{ item.addressInfo.city2 }}{{ item.addressInfo.district2 }}{{ item.addressInfo.receiver_address2 }}
								</view>
							</view>
						</view>
						<view class="address flex justify-start">
							<view class="address-img flex justify-center align-center">
								<image src="../../static/10176.png" mode=""></image>
							</view>
							<view class="address-info">
								<view class="address-title flex justify-start align-center text-bold">

									<view class="address-name text-333 text-lg">{{ item.addressInfo.receiver_name }}
									</view>
									<view class="address-phone text-333 text-lg">{{ item.addressInfo.receiver_mobile }}
									</view>
								</view>
								<view class="address-pos text-333 text-df">
									{{ item.addressInfo.province }}{{ item.addressInfo.city }}{{ item.addressInfo.district }}{{ item.addressInfo.receiver_address }}
								</view>
							</view>
						</view>
					</view>
					<view class="order-item-title  justify-between align-center" style=" background: rgba(78,140,238,0.08);
border-radius: 20rpx">
						<view class="text-666 text-df" style="padding: 15rpx;">
							<text>联系人：{{item.contacts_name }}</text>
						</view>
						<view class="text-666 text-df padding" style="padding: 15rpx;">
							<text>联系电话：{{item.contacts_phone}}</text>
						</view>
					</view>

				</view>
			</block>
		</view>
		<view class="order-list" v-if="orderType == 21">
			<block v-for="(item, index) in listData" :key="item.order_sn">
				<view class="order-item" @click.stop="handleDetail(item)">
					<view class="order-item-title flex justify-between align-center">
						<view class="text-666 text-df">
							<text>{{ item.create_time }}</text>
						</view>
						<view class="order-item-title-status text-df"
							:style="{color:(item.status == -1 || item.status == -3)?'#999':''}">
							<text>{{item.status | transportTabs}}</text>
						</view>
					</view>
					<view class="order-item-title  justify-between align-center" style=" background: rgba(78,140,238,0.08);
					border-radius: 20rpx">
						<view class="text-666 text-df" style="padding: 15rpx;">
							<text>联系人：{{item.contacts_name }}</text>
						</view>
						<view class="text-666 text-df padding" style="padding: 15rpx;">
							<text>联系电话：{{item.contacts_phone}}</text>
						</view>
					</view>

				</view>
			</block>
		</view>
		<view class="order-list" v-if="orderType == 3">
			<block v-for="(item, index) in listData" :key="item.order_sn">
				<view class="order-item" @click.stop="handleDetail(item)">
					<view class="order-item-title flex justify-between align-center">
						<view class="text-666 text-df">
							<text>{{ item.order_sn }}</text>
							<!-- <text>{{ item.create_time}}</text> -->
						</view>
						<!-- 用户端状态值 -1取消 0待付款 1已付款 2已发货 3已完成 4已评价 -->
						<!-- 商家端状态值 （-3商家已取消订单）  0待付款（取消订单，修改金额） 1待发货（发货）2已发货 -->
						<view class="order-item-title-status text-df"
							:style="{color:(item.status == -1 || item.status == -3)?'#999':''}">
							<text>{{item.status | transformStatus}}</text>
						</view>
					</view>
					<view class="order-item-content flex justify-between solid-bottom"
						v-for="(oItem, oIndex) in item.goods" :key="oIndex">
						<view class="order-item-img">
							<fu-image :src="oItem.goods_thumb" mode="aspectFill"></fu-image>
						</view>
						<view class="order-item-info">
							<view class="order-item-name text-df text-333 text-cut-2">{{ oItem.goods_name }}</view>
							<view class="order-item-sku text-df text-sm text-999">{{ oItem.sku_name }}</view>
							<!-- 状态 -->
							<!-- 判断是否成团  拼图订单 已支付 未成团-->
							<view
								v-if="item.order_type==5 && item.status == 1 && item.group_info && item.group_info.is_full != 1 "
								class="text-right" style="color: rgb(247, 173, 50); font-size: 24rpx">未成团</view>
							<!-- 判断是否成团  预售订单 已支付 未付尾款（尾款是否完成）-->
							<view v-if="item.order_type == 7 && item.status == 1  && item.final_status !=1"
								class="text-right" style="color: rgb(247, 173, 50); font-size: 24rpx">尾款未支付</view>
							<view class="text-right" v-if="oItem.order_refund_status == -2"
								style="color: rgb(247, 173, 50); font-size: 24rpx">售后取消</view>
							<view class="text-right" v-if="oItem.order_refund_status == -1"
								style="color: rgb(247, 173, 50); font-size: 24rpx">申请驳回</view>
							<view class="text-right" v-if="oItem.order_refund_status == 0"
								style="color: rgb(247, 173, 50); font-size: 24rpx">售后中</view>
							<view class="text-right" v-if="oItem.order_refund_status == 3"
								style="color: rgb(247, 173, 50); font-size: 24rpx">退款成功</view>
							<view class="text-right" v-if="oItem.order_refund_status == 2"
								style="color: rgb(247, 173, 50); font-size: 24rpx">商家确认收货</view>
							<view class="text-right" v-if="oItem.order_refund_status == 1"
								style="color: rgb(247, 173, 50); font-size: 24rpx">同意申请</view>
							<view class="text-right" v-if="oItem.order_refund_status == -999"
								style="color: rgb(247, 173, 50); font-size: 24rpx">申请售后</view>
							<view class="order-price flex justify-between align-center">
								<text class="text-price text-lg text-bold text-333">{{ oItem.calculate_price }}</text>
								<text class="text-999 text-sm">x{{ oItem.num }}</text>
							</view>
						</view>
					</view>
					<!-- 普通商品 -->
					<view class="price-box"
						:class="[item.is_integral_reduce==1 ? 'flex justify-between width100' : '']">
						<text>{{ item.create_time}}</text>
						<!-- 商品使用积分抵扣 -->
						<view v-if="item.is_integral_reduce==1" class="padding-top-10">
							<text class="text-dfs text-333">使用{{item.integral_reduce || 0}}积分抵扣了
								<text class="text-price  fu-cred">{{item.reduce_money || 0}}</text> </text>
						</view>
						<view v-if='item.coupon_money'>
							优惠: {{item.coupon_money}}
						</view>
						<view v-if="item.is_integral_reduce!=1 && !item.coupon_money">
						</view>

						<view><text>
								共{{item.goods_total}}件商品，
							</text>合计：<text class="price">{{ item.payable_money }}</text></view>
					</view>
					<!-- 商家端状态值 （-3商家已取消订单）  0待付款（取消订单，修改金额） 1待发货（发货）2已发货 -->
					<view class="order-btn-wrap flex justify-end align-center"
						v-if="item.status == -3 || item.status == -1">
						<view class="order-btn text-333 text-center text-sm margin-left-sm"
							@click.stop="delOrder(item.order_sn)">删除订单</view>
					</view>
					<view class="order-btn-wrap flex justify-end align-center" v-if="item.status == 0">
						<view class="order-btn text-333 text-center text-sm margin-left-sm"
							@click.stop="cancalOrderShow(item.order_sn)">取消订单</view>
					</view>
					<view class="order-btn-wrap flex justify-end align-center" v-if="item.status == 3">
						<view class="order-btn text-333 text-center text-sm margin-left-sm"
							@click.stop="handleDetail(item)">查看详情</view>
					</view>
					<view class="order-btn-wrap flex justify-end align-center" v-if="item.status == 4">
						<view class="order-btn text-333 text-center text-sm margin-left-sm"
							@click.stop="handleDetail(item)">查看评价</view>
					</view>
					<view class="order-btn-wrap flex justify-end align-center" v-if="item.status == 2">
						<view class="order-btn text-333 text-center text-sm margin-left-sm"
							@click.stop="checkLogistics(item.order_sn)">查看物流</view>
					</view>
					<view class="order-btn-wrap flex justify-end align-center" v-if="item.status == 1">
						<view class="order-btn text-333 text-center text-sm margin-left-sm active"
							@click.stop="sureDeliver(item.order_sn)">确认发货</view>
					</view>
				</view>
			</block>
		</view>
		<view class="order-list" v-if="orderType == 5">
			<block v-for="(item, index) in listData" :key="item.order_sn">
				<view class="order-item" @click.stop="handleDetail(item)">
					<view class="order-item-title flex justify-between align-center">
						<view class="text-666 text-df">
							<text>订单编号：{{ item.order_sn }}</text>
						</view>
						<!-- 用户端状态值 -1取消 0待付款 1已付款 2已发货 3已完成 4已评价 -->
						<!-- 商家端状态值 （-3商家已取消订单）  0待付款（取消订单，修改金额） 1待发货（发货）2已发货 -->
						<view class="order-item-title-status text-df">
							<text>{{item.group_info.is_full | assembleStatus}}</text>
						</view>
					</view>
					<view class="order-item-content flex justify-between solid-bottom"
						v-for="(oItem, oIndex) in item.goods" :key="oIndex">
						<view class="order-item-img">
							<fu-image :src="oItem.goods_thumb" mode="aspectFill"></fu-image>
						</view>
						<view class="order-item-info">
							<view class="order-item-name text-df text-333 text-cut">{{ oItem.goods_name }}</view>
							<view class="order-item-sku text-df text-sm text-999">{{ oItem.sku_name }}</view>
							<!-- 状态 -->
							<!-- 判断是否成团  拼图订单 已支付 未成团-->
							<view
								v-if="item.order_type==5 && item.status == 1 && item.group_info && item.group_info.is_full != 1 "
								class="text-right" style="color: rgb(247, 173, 50); font-size: 24rpx">未成团</view>
							<!-- 判断是否成团  预售订单 已支付 未付尾款（尾款是否完成）-->
							<view v-if="item.order_type == 7 && item.status == 1  && item.final_status !=1"
								class="text-right" style="color: rgb(247, 173, 50); font-size: 24rpx">尾款未支付</view>
							<view class="text-right" v-if="oItem.order_refund_status == -2"
								style="color: rgb(247, 173, 50); font-size: 24rpx">售后取消</view>
							<view class="text-right" v-if="oItem.order_refund_status == -1"
								style="color: rgb(247, 173, 50); font-size: 24rpx">申请驳回</view>
							<view class="text-right" v-if="oItem.order_refund_status == 0"
								style="color: rgb(247, 173, 50); font-size: 24rpx">售后中</view>
							<view class="text-right" v-if="oItem.order_refund_status == 3"
								style="color: rgb(247, 173, 50); font-size: 24rpx">退款成功</view>
							<view class="text-right" v-if="oItem.order_refund_status == 2"
								style="color: rgb(247, 173, 50); font-size: 24rpx">商家确认收货</view>
							<view class="text-right" v-if="oItem.order_refund_status == 1"
								style="color: rgb(247, 173, 50); font-size: 24rpx">同意申请</view>
							<view class="text-right" v-if="oItem.order_refund_status == -999"
								style="color: rgb(247, 173, 50); font-size: 24rpx">申请售后</view>
							<view class="order-price flex justify-between align-center">
								<text class="text-price text-lg text-bold text-333">{{ oItem.calculate_price }}</text>
								<text class="text-999 text-sm">x{{ oItem.num }}</text>
							</view>
						</view>
					</view>
					<!-- 拼团订单 -->
					<view class="price-box">
						<view class="oredr-type"></view>
						<view>
							合计：
							<text class="price text-bold">{{ item.payable_money }}</text>
						</view>
					</view>
					<!-- 判断是否已经成团  (item.order_type==5 && item.group_info && item.group_info.is_full == 1) -->
					<view class="order-btn-wrap flex justify-end align-center"
						v-if="item.group_info.is_full == 1 && item.status == 1"
						@click.stop="sureDeliver(item.order_sn)">
						<!-- 拼团已经完成 -->
						<block>
							<view class="order-btn text-333 text-center text-sm margin-left-sm active">确认发货</view>
						</block>
					</view>
					<!-- <view class="order-btn-wrap flex justify-end align-center" v-if="item.status == 2"></view> -->
				</view>
			</block>
		</view>
		<view class="order-list" v-if="orderType == -1">
			<block v-for="(item, index) in listData" :key="item.order_sn">
				<view class="order-item" @click.stop="handleDetail(item)">
					<view class="order-item-title flex justify-between align-center">
						<view class="text-666 text-df">
							<!-- <text>订单编号：{{ item.order_sn }}</text> -->
							<text>{{ item.create_time }}</text>
						</view>
						<!-- 用户端状态值 -1取消 0待付款 1已付款 2已发货 3已完成 4已评价 -->
						<!-- 商家端状态值 （-3商家已取消订单）  0待付款（取消订单，修改金额） 1待发货（发货）2已发货 -->
						<view class="order-item-title-status text-df">
							<text>{{item.status | afterStatus}}</text>
						</view>
					</view>
					<view class="order-item-content flex justify-between solid-bottom">
						<view class="order-item-img">
							<fu-image :src="item.goods_thumb" mode="aspectFill"></fu-image>
						</view>
						<view class="order-item-info">
							<view class="order-item-name text-df text-333 text-cut-2">{{ item.goods_name }}</view>
							<view class="order-item-sku text-df text-sm text-999">{{ item.sku_name }}</view>
							<!-- 状态 -->
							<!-- 判断是否成团  拼图订单 已支付 未成团-->
							<view
								v-if="item.order_type==5 && item.status == 1 && item.group_info && item.group_info.is_full != 1 "
								class="text-right" style="color: rgb(247, 173, 50); font-size: 24rpx">未成团</view>
							<!-- 判断是否成团  预售订单 已支付 未付尾款（尾款是否完成）-->
							<view v-if="item.order_type == 7 && item.status == 1  && item.final_status !=1"
								class="text-right" style="color: rgb(247, 173, 50); font-size: 24rpx">尾款未支付</view>
							<view class="text-right" v-if="item.order_refund_status == -2"
								style="color: rgb(247, 173, 50); font-size: 24rpx">售后取消</view>
							<view class="text-right" v-if="item.order_refund_status == -1"
								style="color: rgb(247, 173, 50); font-size: 24rpx">申请驳回</view>
							<view class="text-right" v-if="item.order_refund_status == 0"
								style="color: rgb(247, 173, 50); font-size: 24rpx">售后中</view>
							<view class="text-right" v-if="item.order_refund_status == 3"
								style="color: rgb(247, 173, 50); font-size: 24rpx">退款成功</view>
							<view class="text-right" v-if="item.order_refund_status == 2"
								style="color: rgb(247, 173, 50); font-size: 24rpx">商家确认收货</view>
							<view class="text-right" v-if="item.order_refund_status == 1"
								style="color: rgb(247, 173, 50); font-size: 24rpx">同意申请</view>
							<view class="text-right" v-if="item.order_refund_status == -999"
								style="color: rgb(247, 173, 50); font-size: 24rpx">申请售后</view>
							<view class="order-price flex justify-between align-center">
								<text class="text-price text-lg text-bold text-333">{{ item.goods.shop_price }}</text>
								<text class="text-999 text-sm">x{{ item.num }}</text>
							</view>
						</view>
					</view>
					<!-- 预售订单区分 -->
					<view v-if='item.order_type ==7' class="price-box">
						<view class="oredr-type cu-tag round line-red" v-if="!isShowLoading">预售</view>
						<view>
							定金：
							<text class="price" style="margin-right: 10rpx;">{{ item.payable_money }}</text>
							尾款：
							<text class="price">{{ item.final_order.payable_money }}</text>
						</view>
					</view>
					<!-- 拼团订单 -->
					<view v-else-if='item.order_type == 5' class="price-box">
						<view class="oredr-type cu-tag round line-red" v-if="!isShowLoading">拼团</view>
						<view>
							合计：
							<text class="price text-bold">{{ item.refund_money }}</text>
						</view>
					</view>
					<!-- 普通商品 -->
					<view class="price-box" :class="[item.is_integral_reduce==1 ? 'flex justify-between width100' : '']"
						v-else>
						<!-- 商品使用积分抵扣 -->
						<view v-if="item.is_integral_reduce==1" class="padding-top-10">
							<text class="text-dfs text-333">使用{{item.integral_reduce || 0}}积分抵扣了
								<text class="text-price  fu-cred">{{item.reduce_money || 0}}</text> </text>
						</view>
						<view v-if='item.coupon_money'>
							优惠: {{item.coupon_money}}
						</view>
						<view v-if="item.is_integral_reduce!=1 && !item.coupon_money">
						</view>
						<view>合计：<text class="price text-bold">{{ item.refund_money }}</text></view>
					</view>
					<!-- 商家端状态值 （-3商家已取消订单）  0待付款（取消订单，修改金额） 1待发货（发货）2已发货 -->
					<view class="order-btn-wrap flex justify-end align-center"
						v-if="item.status == -3 || item.status == -1">
						<view class="order-btn text-333 text-center text-sm margin-left-sm"
							@click.stop="delOrder(item.order_sn)">删除订单</view>
					</view>
					<view class="order-btn-wrap flex justify-end align-center"
						v-if="item.status == 0 && item.refund_type == 1">
						<view class="order-btn text-333 text-center text-sm margin-left-sm"
							@click.stop="showAfter('refuse',item)">拒绝退款</view>
						<view class="order-btn text-333 text-center text-sm margin-left-sm active"
							@click.stop="showAfter('agree',item)">同意退款</view>
					</view>
					<view class="order-btn-wrap flex justify-end align-center"
						v-if="item.status == 2 && item.refund_type == 2">
						<view class="order-btn text-333 text-center text-sm margin-left-sm active"
							@click.stop="showAfter('agree',item)">同意退款</view>
					</view>
					<view class="order-btn-wrap flex justify-end align-center"
						v-if="item.status == 0 && item.refund_type == 2">
						<view class="order-btn text-333 text-center text-sm margin-left-sm"
							@click.stop="showAfter('refuse',item)">拒绝退货</view>
						<view class="order-btn text-333 text-center text-sm margin-left-sm active"
							@click.stop="agreeRefundGoods(item)">同意退货</view>
					</view>
					<view class="order-btn-wrap flex justify-end align-center"
						v-if="item.status == 1 && item.refund_type == 2 && item.express_no">
						<view class="order-btn text-333 text-center text-sm margin-left-sm active"
							@click.stop="receiveGoods(item)">确认收货</view>
					</view>

				</view>
			</block>
		</view>
		<!-- 订单 end -->

		<!-- 修改金额 start -->
		<fu-popup mode="right" :z-index="99" v-model="moneyShow" :safeAreaInsetBottom="true">
			<view class="money-wrap" :style="[{ paddingTop: 'calc(' + CustomBar + 'px + ' + '110rpx)' }]">
				<view class="order-item-content flex justify-between margin-bottom-sm"
					v-for="(oItem, oIndex) in amountItem.goods" :key="oIndex">
					<view class="order-item-img">
						<fu-image :src="oItem.goods_thumb" mode="aspectFill"></fu-image>
					</view>
					<view class="order-item-info">
						<view class="order-item-name text-df text-333 text-cut">{{ oItem.goods_name }}</view>
						<view class="order-item-sku text-df text-sm text-999">{{ oItem.sku_name }}</view>
						<view class="order-price text-df text-sm text-999">
							<text>实付价：</text>
							<text class="text-price">{{ oItem.goods_money }}</text>
						</view>
						<view class="order-price flex justify-between align-center ">
							<view class=" text-lg flex justify-start align-end margin-right">
								<view class="text-symbol">￥</view>
								<input type="number" placeholder="请输入减免金额" placeholder-class="placeholder"
									v-model="oItem.modify_price" @input="moneyChange($event, oIndex)" />
							</view>
							<view class="text-999 text-sm num">x{{ oItem.num }}</view>
						</view>
					</view>
				</view>
				<view class="money-btn solid-top">
					<view class="btn  text-333 text-center" @click="sureModify">确认修改</view>
				</view>
			</view>
		</fu-popup>
		<!-- 修改金额 end -->
		<!-- 取消订单 start -->
		<fu-popup mode="bottom" :z-index="99" v-model="orderShow" borderRadius="16" :safeAreaInsetBottom="true">
			<view class="cancel-order">
				<view class="cancel-order-title flex justify-between align-center">
					<view></view>
					<view class="order-title-center flex justify-center align-center">
						<view class="circle shallow round"></view>
						<view class="circle round"></view>
						<view class="text-000 text-lg">取消订单</view>
						<view class="circle  round"></view>
						<view class="circle shallow round"></view>
					</view>
					<view class="order-title-cancle cuIcon-roundclose text-xl" @click="orderShow = false"></view>
				</view>
				<view class="cancel-order-tipstext-666 text-sm">请选择取消订单原因</view>
				<view class="cancel-order-reason">
					<view class="reason-item flex justify-between align-center solid-bottom"
						v-for="(item, index) in cancelOrderReason" :key="item.id"
						@click="chooseCancelReason(item, index)">
						<view class="text-333 text-df">{{ item.reason }}</view>
						<view
							:class="{ 'cuIcon-round': !item.active, 'cuIcon-roundcheck': item.active, 'text-theme': item.active }"
							class="text-xl text-ccc"></view>
					</view>
				</view>
				<view class="cancel-order-btn text-lg text-white text-center" @click.stop="cancalOrder">取消订单</view>
			</view>
		</fu-popup>
		<!-- 取消订单 end -->
		<fu-popup v-model="showDrawer" mode="right" :safe-area-inset-bottom="true" :border-radius="0" width='70%'>
			<view class="container" :style="[{paddingTop: CustomBar+'px'}]">
				<scroll-view class="pop-content" scroll-y>
					<view class="title text-bold" style="font-size: 32rpx;margin-bottom: 40rpx;">筛选</view>
					<view class="text-lg text-bold" style="width: 100%;margin-bottom: 20rpx;">
						订单号
					</view>
					<view class="order-search">
						<input v-model="filterKeywords" :adjust-position="false" type="text" placeholder="请输入订单号"
							confirm-type="search" />
					</view>
					<view class="margin-top">
						<view class="flex justify-between">
							<text class="text-lg text-bold">{{orderType == -1?'申请时间':'下单时间'}}</text>
							<view class="day flex">
								<text class="text-sm margin-left-sm" :class="[filterDays == 7?'active-filter-item':'']"
									@click="getDate(7)">7天</text>
								<text class="text-sm margin-left-sm" :class="[filterDays == 30?'active-filter-item':'']"
									@click="getDate(30)">近30天</text>
							</view>
						</view>
						<view class="margin-top flex align-center justify-center">
							<view class="">
								<text class="margin-right" :style="{color:filterStartDate?'#333':'#999'}"
									@click="seletTime('start')">{{filterStartDate || '请选择开始时间'}}</text>
								-
								<text class="margin-left" :style="{color:filterEndDate?'#333':'#999'}"
									@click="seletTime('end')">{{filterEndDate || '请选择结束时间'}}</text>
							</view>
						</view>
						<view class="order-state margin-top flex flex-direction">
							<view class="text-lg text-bold">
								{{orderType == -1?'售后状态':'订单状态'}}
							</view>
							<view class="flex margin-top-sm flex-wrap">
								<block v-for="(item,index) in filterOrderStates" :key="index">
									<text class="text-item"
										:class="[filterOrderType == item.id?'active-filter-item':'']"
										@click="filterOrderChange(item)">{{item.name}}</text>
								</block>
							</view>
						</view>
						<!-- <view class="activity-box margin-top flex flex-direction" v-if="orderType == 3">
							<view class="text-lg">
								活动类型
							</view>
							<view class="flex margin-top-sm flex-wrap">
								<text class="text-item" :class="[filterGenre == 0?'active-filter-item':'']"
									@click="chooseFilterGenre(0)">全部</text>
								<text class="text-item" :class="[filterGenre == 1?'active-filter-item':'']"
									@click="chooseFilterGenre(1)">秒杀</text>
							</view>
						</view> -->
						<view class="activity-box margin-top flex flex-direction" v-if="orderType == -1">
							<view class="text-lg text-bold">
								售后方式
							</view>
							<view class="flex margin-top-sm flex-wrap">
								<text class="text-item" :class="[filterAfterType == 0?'active-filter-item':'']"
									@click="chooseFilterType(0)">全部</text>
								<text class="text-item" :class="[filterAfterType == 1?'active-filter-item':'']"
									@click="chooseFilterType(1)">仅退款</text>
								<text class="text-item" :class="[filterAfterType == 2?'active-filter-item':'']"
									@click="chooseFilterType(2)">退货退款</text>
							</view>
						</view>
					</view>
				</scroll-view>
				<view class="action-box pop-btn">
					<view class="action reset" @tap.stop="resetPop">重置</view>
					<view class="action confirm" @tap.stop="confirmPop">确定</view>
				</view>
			</view>
		</fu-popup>
		<!-- 同意退款 start -->
		<fu-popup mode="center" :z-index="99" v-model="agreeShow">
			<view class="agree-box flex flex-direction">
				<view class="flex justify-center padding text-lg">请输入退款金额</view>
				<view class="agree-input">
					<input type="number" v-model="refundMoney" placeholder="请输入退款金额" />
				</view>
				<view class="agree-bt" @click="agreeRefund">
					确认
				</view>
			</view>
		</fu-popup>
		<!-- 同意退款 end -->
		<!-- 同意退款 start -->
		<fu-popup mode="center" :z-index="99" v-model="refuseShow" @closePopu="closePopu">
			<view class="flex flex-direction justify-center align-center">
				<view class="refuse-box flex flex-direction">
					<view class="flex justify-center padding text-lg">请填写拒绝原因</view>
					<view class="refuse-text">
						<textarea v-model="refuseReason" placeholder="请输入拒绝原因" />
					</view>
					<view class="refuse-bt" @click="refuseRefund">
						确认
					</view>
				</view>
				<view class="cuIcon-close text-xl text-white margin-top" @tap.stop="refuseShow = false"></view>
			</view>
		</fu-popup>
		<!-- 同意退款 end -->
		<!-- 空状态 start-->
		<fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
			:listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
		<!-- 空状态 end -->
		<!-- 断网检测 start -->
		<fu-notwork></fu-notwork>
		<!-- 断网检测 end -->
		<!-- 选择生日 start -->
		<w-picker :visible.sync="timeVisible" mode="date" fields="day" themeColor="#FC6497" :disabled-after="true"
			@confirm="onConfirm" ref="date"></w-picker>
		<!-- 选择生日 end -->
	</view>
</template>
<script>
	import wPicker from "../../../../shop/components/w-picker/w-picker.vue";
	//运输订单
	let transportTabs = [{
			id: 'all',
			name: '全部',
			state: 0
		},
		{
			id: 'auditing',
			name: '待审核',
			state: 7
		},
		{
			id: 'approved',
			name: '已审核',
			state: 8 // 待更改0
		},
		{
			id: 'paid',
			name: '已付款',
			state: 1
		},
		{
			id: 'canceled',
			name: '已取消',
			state: -1
		}
	];
	let normalTabs = [{
			id: 'all',
			name: '全部',
			state: 0
		},
		{
			id: 'unpay',
			name: '待付款',
			state: 1
		},
		{
			id: 'unship',
			name: '待发货',
			state: 2
		},
		{
			id: 'ship',
			name: '已发货',
			state: 3
		},
		{
			id: 'unevaluation',
			name: '待评价',
			state: 4
		}
	];
	let assembleTabs = [{
			id: 'all',
			name: '全部',
			state: 0
		},
		{
			id: 'ongoing',
			name: '拼团中',
			state: 4
		},
		{
			id: 'successfully',
			name: '已成团',
			state: 5
		}
	];
	let afterTabs = [{
			id: 'all',
			name: '全部',
			state: 0
		},
		{
			id: 'apply',
			name: '申请中',
			state: 6
		},
		{
			id: 'wait_revice',
			name: '待收货',
			state: 1
		},
		{
			id: 'send_back',
			name: '已寄回',
			state: 7
		},
		{
			id: 'have_refund',
			name: '已退款',
			state: 8
		},
		{
			id: 'have_refused',
			name: '已拒绝',
			state: 9
		}
	];
	//引入混入
	import paging_list from '@/common/mixin/paging_list.js';
	export default {
		components: {
			wPicker
		},
		mixins: [paging_list],
		data() {
			return {
				transportTabs: Object.freeze(transportTabs), //运输
				normalTabs: Object.freeze(normalTabs), //tabs内容
				assembleTabs: Object.freeze(assembleTabs), //tabs内容
				afterTabs: Object.freeze(afterTabs), //tabs内容
				type: 'all', //all全部 unpay待付款 unship待发货 ship已发货
				keywords: '', //搜索关键词
				minixPagingListsApi: global.apiUrls.getShopOrderList, //混入获取列表接口名
				allowOnloadGetList: false, //是否允许onlaod加载数据
				pageingListApiMethod: 'post', //接口类型属于get
				orderShow: false, //取消订单弹窗显示
				order_sn: '', //取消订单、拒绝售后时记录点击的订单编号
				cancelOrderReasonId: '', //选择的取消订单原因id
				cancelOrderReason: [], //取消订单原因列表
				moneyShow: false, //修改金额弹框显示
				amountItem: {}, //修改金额数据
				amountIndex: '', //修改金额下标
				refundShow: false, //拒绝售后弹框
				refundReason: '', //拒绝原因
				orderType: 20,
				showDrawer: false,
				startDate: '',
				endDate: '',
				dateType: '',
				afterType: 0,
				genre: 0,
				filterOrderStates: [],
				filterOrderType: '',
				filterKeywords: '',
				filterStartDate: '',
				filterEndDate: '',
				filterAfterType: 0,
				filterGenre: 0,
				timeVisible: false, //时间组件
				dateValue: '', // {String} 生日默认显示
				filterDays: '',
				agreeShow: false,
				afterOrder: '',
				refundMoney: 0,
				refuseShow: false,
				refuseReason: ''
			};
		},

		onLoad(options) {

			// 跳转订单列表未携带参数时默认全部状态
			const {
				type = 'all'
			} = options;
			// 获取当前选中状态的tab数据 包括下标，类型等
			// const _item = this.tabs.find(item => item.id == type);
			// this.current = _item.state;
			// this.type = _item.id;
			// console.log('_item', _item)
			this.getOrderReason();
			// 监听页面更新
			uni.$on('onPageUpdata', this.onPageUpdata);

		},
		onUnload() {
			// 移除页面更新监听
			uni.$off('onPageUpdata', this.onPageUpdata)
		},
		onShow() {
			// 获取数据
			let store_level = uni.getStorageSync("USER_INFO").store_level;
			console.log(store_level,"*******************")
			let type = "all";
			if(store_level==1) {
				this.orderType = 3
			}
			if(store_level==2){
				this.orderType = 20
			}
			if(store_level==3){
				this.orderType = 21
			}
			console.log(store_level,"qwqwqwqw")
			if (type) {
				this.orderType = 3
					this.type = 'all'
					this.minixPagingListsApi = global.apiUrls.getShopOrderList;
					this.startDate = '';
					this.endDate = '';
					this.dateType = ''
					this.pagingListToggle();
				// if (type == 'refund') {
				// 	this.orderType = -1
				// 	this.type = 'all'
				// 	this.minixPagingListsApi = global.apiUrls.getGoodsAfterSale;
				// 	this.startDate = '';
				// 	this.endDate = '';
				// 	this.dateType = ''
				// 	this.pagingListToggle();
				// } else {
				// 	// this.orderType = type
				// 	this.type = type
				// 	this.minixPagingListsApi = global.apiUrls.getShopOrderList;
				// 	this.startDate = '';
				// 	this.endDate = '';
				// 	this.dateType = ''
				// 	this.pagingListToggle();
				// }
				uni.setStorageSync('orderType', null)
			} else {
				this.pagingListToggle();
				// console.log(this.listData,"&&&&&&&&&&&&&&&&&&&&&&&");
			}

		},
		mounted() {

		},
		filters: {
			/**
			 *@description 过滤状态值
			 */
			transportTabs(val) {
				switch (val) {
					case -3:
						return '商家已取消';
						break;
					case 0:
						return '待付款';
						break;
					case -1:
						return '已取消';
						break;
					case 1:
						return '已付款';
						break;
					case 7:
						return '审核中';
						break;
					case 8:
						return '已审核';
						break;
					case 4:
						return '已完成';
						break;
				}
			},
			transformStatus(val) {
				switch (val) {
					case -3:
						return '商家已取消';
						break;
					case -1:
						return '已关闭';
						break;
					case 0:
						return '待付款';
						break;
					case 1:
						return '待发货';
						break;
					case 2:
						return '已发货';
						break;
					case 3:
						return '待评价';
						break;
					case 4:
						return '已完成';
						break;
				}
			},
			/**
			 *@description 过滤状态值
			 */
			afterStatus(val) {
				// 售后申请状态0:申请中;-2:用户取消;-1:驳回;1:同意;2:确认收回;3:确认打款
				switch (val) {
					case -2:
						return '用户取消';
						break;
					case -1:
						return '已拒绝';
						break;
					case 0:
						return '申请中';
						break;
					case 1:
						return '待收货';
						break;
					case 2:
						return '已寄回';
						break;
					case 3:
						return '已退款';
						break;
				}
			},
			assembleStatus(val) {
				switch (val) {
					case 0:
						return '进行中';
						break;
					case 1:
						return '已成团';
						break;
				}
			}
		},
		methods: {
			onConfirm(result) {
				let time = new Date(result.value).getTime();
				if (this.dateType == 'start') {
					if (this.filterEndDate) {
						let end = new Date(this.filterEndDate).getTime();
						if (end <= time) {
							this.$message.info('开始日期不能大于等于结束日期');
							return
						}
					}
					this.filterStartDate = result.value;
				} else {
					if (this.filterStartDate) {
						let start = new Date(this.filterStartDate).getTime();
						if (start >= time) {
							this.$message.info('结束日期不能小于等于开始日期');
							return
						}
					}
					this.filterEndDate = result.value;
				}
				this.dateType = ''
				this.filterDays = ''
			},
			seletTime(type) {
				this.dateType = type
				this.$refs.date.show();
			},
			chooseFilterGenre(genre) {
				this.filterGenre = genre
			},
			chooseFilterType(type) {
				this.filterAfterType = type
			},
			resetPop() {
				this.filterOrderType = 'all';
				this.filterKeywords = ''
				this.filterStartDate = '';
				this.filterEndDate = '';
				this.filterAfterType = 0;
				this.filterGenre = 0;
				this.filterDays = '';
				this.dateType = ''
			},
			confirmPop() {
				this.type = this.filterOrderType;
				this.keywords = this.filterKeywords;
				this.startDate = this.filterStartDate;
				this.endDate = this.filterEndDate;
				this.afterType = this.filterAfterType;
				this.genre = this.filterGenre;
				this.showDrawer = false
				this.dateType = ''
				this.filterDays = ''
				this.filterStartDate = ''
				this.filterEndDate = ''
				this.pagingListToggle();
			},
			filterOrderChange(item) {
				this.filterOrderType = item.id
			},
			getDate(type) {
				if (this.filterDays == type) {
					this.dateType = ''
					this.filterDays = ''
					this.filterStartDate = ''
					this.filterEndDate = ''
				} else {
					this.dateType = '';
					this.filterDays = type
					this.filterEndDate = this.getDateString(0)
					if (type == 7) {
						this.filterStartDate = this.getDateString(-7)
					} else {
						this.filterStartDate = this.getDateString(-30)
					}
				}
			},
			getDateString(day) {
				var today = new Date();
				var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
				today.setTime(targetday_milliseconds);
				var tYear = today.getFullYear();
				var tMonth = today.getMonth();
				var tDate = today.getDate();
				tMonth = this.doHandleMonth(tMonth + 1);
				tDate = this.doHandleMonth(tDate);
				return tYear + "-" + tMonth + "-" + tDate;
			},
			doHandleMonth(month) {
				var m = month;
				if (month.toString().length == 1) {
					m = "0" + month;
				}
				return m;
			},
			filterShow() {
				switch (this.orderType) {
					case 3:
						this.filterOrderStates = this.normalTabs
						break;
					case 5:
						this.filterOrderStates = this.assembleTabs
						break;
					case -1:
						this.filterOrderStates = this.afterTabs
						break;
					default:
						break;
				}
				this.filterOrderType = this.type;
				this.filterKeywords = this.keywords
				this.filterStartDate = this.startDate;
				this.filterEndDate = this.endDate;
				this.filterAfterType = this.afterType;
				this.filterGenre = this.genre;
				this.showDrawer = true;
			},
			orderTypeChange(type) {
				this.orderType = type
				this.type = 'all'
				this.minixPagingListsApi = global.apiUrls.getShopOrderList;
				if (this.orderType == 5) {
					this.minixPagingListsApi = global.apiUrls.getAssembleOrderList;
				}
				if (this.orderType == -1) {
					this.minixPagingListsApi = global.apiUrls.getGoodsAfterSale;
				}
				this.startDate = '';
				this.endDate = '';
				this.dateType = ''
				this.pagingListToggle();
			},
			/**
			 * @description 监听页面更新的回调函数
			 * @param {Object} res = 要更新的配置参数
			 */
			onPageUpdata(res) {
				this.refreshOrderList();
			},
			/**
			 * @description 重置列表
			 * @param {string} value
			 * */
			refreshOrderList(value) {
				this.page = 1;
				this.status = 'more';
				this.getOrderReason();
			},
			/**
			 * @description 返回
			 */
			handleBack() {
				uni.navigateBack({
					delta: 1
				});
			},
			/**
			 * @description 清除搜索
			 */
			handleClear() {
				this.keywords = '';
				this.pagingListToggle();
			},
			/**
			 * @param {Object} val
			 */
			handleSearch() {
				this.pagingListToggle();
			},

			/**
			 * @description 标签返回值
			 */
			tabChange(val) {
				console.log(val);
				this.type = val.id;
				this.pagingListToggle();
			},
			/**
			 * @description 混入传参钩子函数
			 * @param type 获取数据类型 type 1为收藏列表 3为浏览历史
			 */
			pagingListPostData() {
				return {
					type: this.type,
					keywords: this.keywords,
					order_type: this.orderType
				};
			},
			/**
			 * @description 打开取消订单弹窗
			 * @param {String,Number} order_sn 订单编号
			 */
			cancalOrderShow(order_sn) {
				this.orderShow = true;
				this.order_sn = order_sn;
			},
			/**
			 * @description 取消订单
			 */
			cancalOrder() {
				let that = this;
				if (!that.cancelOrderReasonId) {
					this.$message.info('请选择取消订单原因');
					return;
				}
				this.orderShow = false;
				this.$util.showModal({
					title: '提示',
					content: '确定要取消订单吗？',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							that.$api
								.post(global.apiUrls.cancelOrder, {
									order_sn: that.order_sn,
									return_id: that.cancelOrderReasonId
								})
								.then(res => {
									console.log(res);
									if (res.data.code == 1) {
										that.order_sn = '';
										that.cancelOrderReasonId = '';
										that.$message.success('操作成功');
										that.pagingListToggle();
										that.cancelOrderReason.forEach(val => {
											val.active = false;
										});
									} else {
										that.$message.info(res.data.msg);
									}
									that.orderShow = false;
								})
								.catch(err => {
									that.orderShow = false;
									console.log(err);
								});
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			},
			/**
			 * @description 选择取消订单原因
			 */
			chooseCancelReason(item, index) {
				this.cancelOrderReason.forEach(val => {
					val.active = false;
				});
				this.cancelOrderReason[index].active = true;
				this.cancelOrderReasonId = item.id;
			},
			/**
			 * @description 获取取消订单原因列表
			 * @param {Number}  type 1、退换货原因 2、取消订单原因
			 */
			getOrderReason() {
				this.$api
					.post(global.apiUrls.cancelReason, {
						type: 2,
						// partner_id: this.$store.state.userInfo.id
					})
					.then(res => {
						console.log('获取取消订单原因列表', res);
						if (res.data.code == 1) {
							let list = res.data.data || [];
							list.forEach(val => {
								val.active = false;
							});
							this.cancelOrderReason = list;
						} else {
							this.$message.info(res.data.msg);
						}
					})
					.catch(err => {
						console.log(err);
					});
			},
			/**
			 * @description 修改金额
			 * @param {Object} item 事件对象数据
			 * @param {Number} index 事件对象下标
			 */
			revisedAmountShow(item, index) {
				// 对象拷贝
				let data = this.$util.deepClone(item);
				this.amountItem = data;
				if (this.amountItem.goods && this.amountItem.goods.length > 0) {
					this.amountItem.goods.forEach(item => {
						item.modify_price = 0
					})
				}
				this.amountIndex = index;
				this.moneyShow = true;
			},
			/**
			 * @description 金额判断
			 */
			moneyChange(e, index) {
				// 减免金额不能小于0
				if (Number(e.detail.value) <= 0) {
					// this.$message.info('减免金额不能小于0');
					this.$nextTick(function() {
						this.amountItem.goods[index].modify_price = '';
					});
				}
				//减免金额不能大于原始金额
				if (Number(e.detail.value) >= Number(this.amountItem.goods[index].goods_money)) {
					this.$message.info('减免金额不能大于实付金额');
					this.$nextTick(function() {
						this.amountItem.goods[index].modify_price = '';
					});
				}
				// 小数点只能到后两位
				if (e.detail.value.toString().split('.')[1] && e.detail.value.toString().split('.')[1].length > 2) {
					this.$message.info('小数点后只能保留两位');
					let num1 = e.detail.value.toString().split('.')[0];
					let num2 = e.detail.value
						.toString()
						.split('.')[1]
						.slice(0, 2);
					this.$nextTick(function() {
						this.amountItem.goods[index].modify_price = `${num1}.${num2}`;
					});
				}
			},
			/**
			 * @description 确认修改金额
			 */
			sureModify() {
				let amountItem = this.amountItem;
				let data = {
					order_sn: amountItem.order_sn,
					goods: []
				};
				amountItem.goods.forEach((val, i) => {
					// modify_price存在且大于0
					if (val.modify_price && val.modify_price > 0) {
						let content = {
							goods_id: val.goods_id,
							modify_price: val.modify_price,
							sku_id: val.sku_id
						};
						data.goods.push(content);
					}
				});
				if (data.goods.length == 0) {
					this.$message.info('请修改金额进行提交');
					return;
				}

				// console.log(data);
				let that = this;
				this.$util.showModal({
					title: '提示',
					content: '确定修改金额吗？',
					success: function(res) {
						if (res.confirm) {
							// console.log('用户点击确定');
							that.$api
								.post(global.apiUrls.shop_modify_order_price, {
									order_sn: data.order_sn,
									goods: JSON.stringify(data.goods)
								})
								.then(res => {
									console.log(res);
									if (res.data.code == 1) {
										that.amountItem = {};
										that.$message.success('操作成功');
										that.pagingListToggle()
										// setTimeout(() => {
										// 	uni.navigateTo({
										// 		url: '/pages/order/order/order-detail/index?order_sn=' + data.order_sn + '&order_type=' +
										// 			amountItem.order_type
										// 	});
										// }, 800);
									} else {
										that.$message.info(res.data.msg);
									}
									that.moneyShow = false;
								})
								.catch(err => {
									that.moneyShow = false;
									console.log(err);
								});
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			},
			/**
			 * @description 确认发货 去选择快递，填写编号
			 * @param {Number,String}  order_sn 订单编号
			 */
			sureDeliver(order_sn) {
				uni.navigateTo({
					url: '/pages/order/order/order-express/index?order_sn=' + order_sn
				});
			},
			checkLogistics(orderSn) {
				this.$urouter.navigateTo({
					url: "/pages/order/order/express-delivery/index",
					params: {
						order_sn: orderSn,
					},
				});
			},
			/**
			 * @description 去查看详情
			 * @param {Number,String}  order_sn 订单编号
			 */
			handleDetail(item) {
				if (this.orderType == -1) {
					this.$urouter.navigateTo({
						url: '/pages/order/order/order-after-detail/index',
						params: {
							id: item.id,
							type: item.status
						}
					});
				}
				if (this.orderType == 3) {
					this.$urouter.navigateTo({
						url: '/pages/order/order/order-detail/index',
						params: {
							order_sn: item.order_sn,
							order_type: item.order_type
						}
					});
				}
				if (this.orderType == 20 || this.orderType == 21) {
					this.$urouter.navigateTo({
						url: '/pages/order/order/order-detail/transport',
						params: {
							order_sn: item.order_sn,
							order_type: item.order_type
						}
					});
				}

			},
			/**
			 * @description 删除订单
			 */
			//
			delOrder(order_sn) {
				let that = this;
				this.$util.showModal({
					title: '提示',
					content: '确定删除吗？',
					success: function(res) {
						if (res.confirm) {
							// console.log('用户点击确定');
							that.$api
								.post(global.apiUrls.shop_delete_order, {
									order_sn: order_sn
								})
								.then(res => {
									console.log(res);
									if (res.data.code == 1) {
										that.$message.success('操作成功');
										that.listData.forEach((item, index) => {
											if (item.order_sn == order_sn) {
												that.listData.splice(index, 1)
											}
										})
										// that.pagingListToggle();
									} else {
										that.$message.info(res.data.msg);
									}
								})
								.catch(err => {
									console.log(err);
								});
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			},
			closePopu() {
				// console.log('pdfisdpfi')
				this.refuseReason = ''
			},
			showAfter(type, order) {
				this.afterOrder = order;
				if (type == 'agree') {
					this.refundMoney = order.refund_money
					this.agreeShow = true
				} else {
					this.refuseShow = true
				}

			},
			agreeRefund() {
				if (!this.refundMoney) {
					this.$message.info('请输入退款金额');
					return
				}
				// if(this.refundMoney > this.afterOrder.refund_money){
				// 	this.$message.info('退款金额不能大于订单金额');
				// 	return
				// }
				let api = global.apiUrls.agreeRefundMoney;
				if (this.afterOrder.status == 2 && this.afterOrder.refund_type == 2) {
					api = global.apiUrls.receiveRefundGoodsRefundMoney;
				}
				this.$api
					.post(api, {
						rfid: this.afterOrder.id,
						refund_money: this.refundMoney
					})
					.then(res => {
						if (res.data.code == 1) {
							this.$message.info('操作成功');
							this.agreeShow = false;
							this.pagingListToggle();
						} else {
							this.$message.info(res.data.msg);
						}
					})
					.catch(err => {
						console.log(err);
					});
			},
			refuseRefund() {
				if (!this.refuseReason) {
					this.$message.info('请输入拒绝原因');
					return
				}
				this.$api
					.post(global.apiUrls.refuseRefundMoney, {
						rfid: this.afterOrder.id,
						reject_reason: this.refuseReason
					})
					.then(res => {
						if (res.data.code == 1) {
							this.$message.info('操作成功');
							this.refuseShow = false;
							this.pagingListToggle();
							this.refuseReason = ''
						} else {
							this.$message.info(res.data.msg);
						}
						this.refuseReason = ''
					})
					.catch(err => {
						console.log(err);
					});
			},
			agreeRefundGoods(order) {
				let that = this;
				this.$util.showModal({
					title: '提示',
					content: '确定同意退货？',
					success: function(res) {
						if (res.confirm) {
							that.$api
								.post(global.apiUrls.agreeRefundMoney, {
									rfid: order.id
								})
								.then(res => {
									if (res.data.code == 1) {
										that.$message.info('操作成功');
										that.pagingListToggle();
									} else {
										that.$message.info(res.data.msg);
									}
								})
								.catch(err => {
									console.log(err);
								});
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			},
			receiveGoods(order) {
				let that = this;
				this.$util.showModal({
					title: '提示',
					content: '确定确认收货？',
					success: function(res) {
						if (res.confirm) {
							that.$api
								.post(global.apiUrls.receiveRefundGoods, {
									rfid: order.id
								})
								.then(res => {
									if (res.data.code == 1) {
										that.$message.info('操作成功');
										that.pagingListToggle();
									} else {
										that.$message.info(res.data.msg);
									}
								})
								.catch(err => {
									console.log(err);
								});
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			}
		}
	};
</script>

<style scoped lang="scss">
	// .container{
	// 	padding-bottom: 100rpx;
	// }
	.price-box {
		// border-bottom: 1px solid #eeeeee;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 20upx 0upx 20upx 0;
		font-size: 24rpx;
		color: #333333;

		.num {
			margin: 0 8upx;
			color: #333333;
		}

		.price {
			font-size: 38rpx;
			color: #FB2A25;

			&:before {
				content: "￥";
				font-size: 24rpx;
				margin: 0 2upx 0 8upx;
			}
		}
	}

	.order-type {
		width: 180rpx;
		text-align: center;
		color: #333;
		font-size: 32rpx;
	}

	.title_a {
		display: block;
		width: 28rpx;
		border: 2rpx solid #fff;
		margin: 18rpx auto;
	}

	.active {
		// color: $theme;

		.title_a {
			border: 2rpx solid #FC6497;

		}
	}

	.padding-bottom-sm {
		padding-bottom: 0px;
	}

	.title_i {
		display: block;
		width: 12px;
		border: 3px solid #fff;
		border-radius: 5px;
		margin: 0 auto;
	}

	.actives {
		font-weight: bold;

		.title_i {
			display: block;
			width: 12px;
			border: 3px solid #FC6497;
			border-radius: 5px;
			margin: 0 auto;
		}
	}

	.filter-icon {
		width: 28rpx;
		height: 30rpx;
	}

	// 搜索 start
	.fu-tabbar {
		position: sticky;
		top: 0;
		left: 0;
		width: 100%;
		z-index: 99999;
		background: #ffffff;
		overflow: hidden;

		.fu-tabbar-con {
			position: relative;

			.search-wrap {
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translate(-50%, -50%);
				// #ifndef MP-WEIXIN
				width: calc(100% - 100rpx);
				// #endif
				// #ifdef MP-WEIXIN
				width: calc(100% - 242rpx);
				// #endif
			}
		}
	}

	// 搜索 end
	//  订单 start
	.order-list {
		padding: 24rpx;
		box-sizing: border-box;

		.order-item {
			
			background: #ffffff;
			border-radius: 16rpx;
			padding: 0 24rpx 24rpx;
			box-sizing: border-box;
			margin-bottom: 24rpx;
			.order-item-title {
				padding: 32rpx 0 24rpx;

				.order-item-title-status {
					color: #FC6497;
				}
			}

			.order-item-content {
				padding: 24rpx 0;

				.order-item-img {
					width: 200rpx;
					height: 200rpx;
					border-radius: 16rpx;
					overflow: hidden;
					// background: #eeeeee;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.order-item-info {
					width: calc(100% - 204rpx);
					margin-left: 20rpx;

					.order-item-sku {
						padding: 16rpx 0 40rpx;
						height: 96rpx;
					}

					.order-price {
						text {
							&:nth-child(1) {
								color: #333333;
							}
						}

					}
				}
			}

			.order-btn-wrap {
				padding-bottom: 32rpx;

				.order-btn {
					width: 170rpx;
					height: 60rpx;
					line-height: 60rpx;
					background: #F6F6F6;
					border-radius: 30rpx;

					&.active {
						background-color: #FC6497;
						color: #FFFFFF;
					}
				}
			}
		}
	}

	.order-price .num {
		width: 120rpx;
	}

	//  订单 end
	// 取消订单 start
	.text-ccc {
		color: #cccccc;
	}

	.cancel-order {
		padding: 0 32rpx;
		box-sizing: border-box;

		.cancel-order-title {
			padding: 32rpx 0;

			.circle {
				width: 8rpx;
				height: 8rpx;
				background: rgba(255, 80, 1, 0.5);
				margin: 0 6rpx;

				&.shallow {
					background: rgba(255, 80, 1, 1);
				}
			}
		}

		.cancel-order-reason {
			.reason-item {
				height: 104rpx;
			}
		}

		.cancel-order-btn {
			margin: 48rpx 0 37rpx;
			height: 90rpx;
			line-height: 90rpx;
			background: #FC6497;
			border-radius: 8rpx;
		}
	}

	// 取消订单 end
	// 修改金额 start
	.money-wrap {
		width: 600rpx;
		min-height: 100%;
		background: #ffffff;
		padding: 0 10rpx;
		padding-bottom: 140rpx;
		padding-bottom: calc(140rpx + constant(safe-area-inset-bottom));
		padding-bottom: calc(140rpx + env(safe-area-inset-bottom));
		box-sizing: border-box;
		position: relative;

		.money-btn {
			position: fixed;
			bottom: 0;
			left: 0;
			width: 100%;
			background: #ffffff;
			padding: 20rpx 32rpx 0;
			box-sizing: border-box;
			padding-bottom: 30rpx;
			padding-bottom: calc(30rpx + constant(safe-area-inset-bottom));
			padding-bottom: calc(30rpx + env(safe-area-inset-bottom));

			.btn {
				width: 100%;
				height: 90rpx;
				border-radius: 8rpx;
				line-height: 90rpx;
				color: #ffffff;
				background: #FC6497;
			}
		}

		.order-item-content {
			.order-item-img {
				width: 180rpx;
				height: 180rpx;
				border-radius: 8rpx;
				overflow: hidden;
				background: #eeeeee;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.order-item-info {
				width: calc(100% - 204rpx);

				.order-item-sku {
					padding: 12rpx 0 0rpx;
					height: 44rpx;
				}

				.order-price {
					padding: 4rpx 0;

					text {
						&:nth-child(2) {
							color: #FC6497;
						}
					}

					.placeholder {
						font-size: 28rpx;
					}

					view {
						&:nth-child(1) {
							color: #FC6497;
							background: #f1f1f1;
							border-radius: 8rpx;

							.text-symbol {
								transform: scale(0.7);
								margin-bottom: -4rpx;
							}
						}
					}
				}
			}
		}
	}

	// 修改金额 end
	// 拒绝原因 start
	uni-textarea {
		width: 100%;
	}

	.bg-lg {
		background: linear-gradient(309deg, #fe3100 0%, #ff5a10 100%);
	}

	// 拒绝原因 end


	// 筛选内容
	.pop-content {
		height: 92%;
		padding: 20rpx;
		padding-bottom: 120rpx;
	}

	.pop-btn {
		position: fixed;
		width: 100%;
		bottom: 0;
		padding: 40rpx 24rpx;
		background: #fff;
		margin-top: 0;
	}

	.action-box {
		display: flex;
		margin-top: 30rpx;
		// margin-bottom: 100rpx;

		.action {
			flex: 1;
			height: 72rpx;
			line-height: 72rpx;
			border-radius: 36rpx;
			font-size: 24rpx;
			text-align: center;
		}

		.action+.action {
			margin-left: 4rpx;
			border-radius: 36rpx;
		}

		.reset {
			color: #333;
			background-color: #F8F8F8;
			margin-right: 24rpx;


		}

		.confirm {
			color: #FFFFFF;
			background: #FC6497;
		}
	}

	.order-search {
		background-color: #F8F8F8;
		padding: 0 24rpx;
		height: 72rpx;
		border-radius: 36rpx;
		display: flex;
		align-items: center;

		input {
			flex: 1;
			text-align: center;
			font-size: 28rpx;
		}
	}

	.active-filter-item {
		background-color: #E7F7EE !important;
		border: 1rpx solid #FC6497;
		color: #FC6497;
	}

	.day {
		text {
			width: 104rpx;
			text-align: center;
			line-height: 48rpx;
			height: 48rpx;
			border-radius: 8rpx;
			background-color: #F8F8F8;
		}
	}

	.text-item {
		width: 148rpx;
		text-align: center;
		line-height: 80rpx;
		height: 80rpx;
		border-radius: 8rpx;
		background-color: #F8F8F8;
		margin: 6rpx;
	}

	/deep/.fu-drawer {
		z-index: 9 !important;
	}

	.agree-box {
		background-color: #fff;
		border-radius: 16rpx;
		width: 550rpx;

		.agree-input {
			background-color: #f8f8f8;
			padding: 20rpx;
			margin: 0 32rpx;
		}

		.agree-bt {
			margin: 32rpx;
			height: 77rpx;
			background-color: #FC6497;
			text-align: center;
			line-height: 77rpx;
			color: #FFFFFF;
			border-radius: 8rpx;
		}
	}

	.refuse-box {
		background-color: #fff;
		border-radius: 16rpx;
		width: 550rpx;

		.refuse-text {
			background-color: #f8f8f8;
			padding: 20rpx;
			margin: 0 32rpx;
			border-radius: 16rpx;

			textarea {
				height: 200rpx;
				font-size: 28rpx;
			}
		}

		.refuse-bt {
			margin: 32rpx;
			text-align: center;
			color: #FC6497;
			border-radius: 8rpx;
			line-height: 100%;
		}
	}

	// 地址信息 start
	.address-wrap {
		// padding: 26rpx 32rpx 34rpx;
		// margin: 0 24rpx;
		// box-sizing: border-box;
		// background: #ffffff;
		// position: relative;

		.img {
			width: 100%;
			height: 6rpx;
			position: absolute;
			bottom: 0;
			left: 0;
		}

		.address {
			.address-img {
				margin-right: 22rpx;

				image {
					width: 50rpx;
					height: 50rpx;
				}
			}

			.address-info {
				.address-title {
					padding: 6rpx 0;

					.tag {
						min-width: 56rpx;
						height: 34rpx;
						line-height: 34rpx;
						text-align: center;
						margin-right: 16rpx;
						border-radius: 8rpx;
						padding: 0 15rpx;
						color: #FC6497;
						background-color: rgba($color: #FC6497, $alpha: 0.1);
						border: 1px solid #FC6497;
					}

					.address-name {}

					.address-phone {
						margin-left: 24rpx;
					}
				}

				.address-pos {
					padding: 6rpx 0;
				}
			}
		}
	}

	// 地址信息 end
</style>